package com.unirio.pm.rules;

import com.unirio.pm.interfaces.PasswordRule;

public class MultipleRegex implements PasswordRule {
	
	String description;
	String [] regexes;
	int score;
	
	public MultipleRegex(String description, String [] regexes, int score){
		this.description = "";
		this.regexes = regexes;
		this.score = score;
	}
	
	public MultipleRegex(String[] regexes, int score) {
		this.regexes = regexes;
		this.score = score;
	}


	@Override
	public int checkRule(String password) {
    	for(int i=0; i<this.regexes.length; i++) {
    		if(!password.matches(regexes[i])) {
    			return 0;
    		}
    	}
    	return this.score;
	}

}
